<template>
	<view class="Invite">



		<u-popup v-model="yqjt" mode="center" :mask-close-able="false">
			<view class="yqbj">
				<view class="toptitle">
					{{yqjtnei.desc}}
				</view>
				<view style="display: flex; margin-top: -20upx; ">
					<image style="width:30upx; height: auto; margin-left: auto;  "
						src="https://webapp.test.shenghua6.cn/st/mini/static/img/xcxydy/guanbisank.png"
						mode="widthFix" @click="yqtcgb"></image>
					<view style="width:40upx;">
					</view>
				</view>
				<!-- 在线按钮 -->


				<view class="yqauto">
					<image class="yqtouxi"
						:src="$global.getImageUrl(yqjtnei.headImg+'?x-oss-process=image/bright,15/resize,m_fill,h_150,w_150', 'https://ourydcimage.shenghua6.cn')"
						mode="widthFix"></image>


				</view>
				<!-- <block style="position:absolute;"> -->

				<!-- 是否在线的绿点 -->
				<image style="width:25upx; height: auto; position:relative;left: 32px;top: -32px; "
					v-if="yqjtnei.isOnline == 1"
					src="https://webapp.test.shenghua6.cn/st/mini/static/img/xcxydy/zaixianann.png"
					mode="widthFix"></image>
				<!-- </block> -->



				<view class="yqname" style="margin-top: -50upx;">
					{{yqjtnei.nickName}}
				</view>
				<view class="zhong yqxixi">
					<p class="sex"
						:style="yqjtnei.sex==1?'background: url('+man+') no-repeat;background-size: contain;':yqjtnei.sex==2?'background: url('+woman+') no-repeat;background-size: contain;':'background: url('+no+') no-repeat;background-size: contain;'">
						<view style="margin-left:15upx;font-size: 22upx;">
							{{yqjtnei.age}}
						</view>
					</p>
					<!-- yqjtnei.costLevel -->
					<img class="vipNum"
						:src="$BASE_URL + '/st/mini/static/img/vip1/vip_' + yqjtnei.costLevel+ '@2x.png'" />

					<view class="beijingkuai">
						{{yqjtnei.city}}
					</view>

				</view>

				<view style="height:6upx;">

				</view>

				<view class="">
					<image style="width:380upx;height: auto;"
						src="https://webapp.test.shenghua6.cn/st/mini/static/img/xcxydy/anjiuzt.png"
						mode="widthFix" @click="yqtcgb('1')"></image>
				</view>

				<view style="height:15upx;"> </view>
			</view>

		</u-popup>

	</view>

</template>

<script>
	export default {
		data() {
			return {
				$BASE_URL: this.$BASE_URL,
				// 邀请进厅弹窗
				yqjt: false,
				// 邀请进厅的内容
				yqjtnei: {},
				no: '',
				man: '',
				woman: '',
				mvp: "",


			}
		},
		mounted() {

			this.man = this.$BASE_URL + '/st/mini/static/img/sex/man.png'
			this.woman = this.$BASE_URL + '/st/mini/static/img/sex/woman.png'
			this.no = this.$BASE_URL + '/st/mini/static/img/sex/no.png'
			this.mvp = this.$BASE_URL + '/st/mini/static/img/chatRoomDetails/mvp.png'





		},
		beforeCreate() {




			// 观察者模式 更新
	
			uni.$on('dkjt', (e) => {
				// 邀请进厅弹窗
				this.yqjt = getApp().globalData.yqjt;
				// 邀请进厅的内容
				this.yqjtnei = getApp().globalData.yqjtnei;
				console.log('观察者模式')
			})

		},

		onLoad() {



		},

		onUnload() {
			// 移除监听事件  
			uni.$off('dkjt');
		},

		methods: {
			// 邀请进厅弹窗的胡关闭

			yqtcgb: function(e) {

				if (e == 1) {
					// 执行去找他去啊进厅

					// 真实
					this.jttyqq(this.yqjtnei.roomId)
					// 模拟

					// this.jttyqq(330590495)


					this.yqjt = false
					getApp().globalData.yqjt = false

				} else {
					//  点击关闭图标 执行关闭

					this.yqjt = false
					getApp().globalData.yqjt = false
				}
				
				
				uni.$emit('dkjt', {});
			},




			// 进厅的统一请求

			// 进厅前请求 统一


// 71 Lika微信小程序点击发现tab在线语聊进厅
// 72 Lika微信小程序首页-附近的人
// 73 Lika微信小程序聊天室关注列表
// 74 Lika微信小程序聊天室推荐列表
// 75 Lika微信小程序聊天室品类列表
// 76 Lika微信小程序搜索页推荐厅
// 77 Lika微信小程序首页推荐弹窗跟随近厅

			jttyqq: function(roomId) {
				var _this = this
				var data = {
					url: "/web/v2/api/chatRoom/inChatRoom",
					methods: "post",
					data: {
						
						roomId: roomId,
						source:"77"
					},
				};
				this.$http(data).then((res) => {
					console.log(res, "房间房间房间房间房间房间房间房间房间");
					if (res.data.code == 21135) {
						//21135 被踢出房间					
						uni.showToast({
							title: '您已被踢出房间',
							icon: "none",
							duration: 2000,
						});

					} else if (res.data.code == 25044) {
						//25044 聊天室已关闭
						uni.showToast({
							title: res.data.msg,
							icon: "none",
							duration: 2000,
						});
						return
					} else if (res.data.code == 21000) {
						var rid = res.data.data.chatRoomInfo.channelId

						// 判断不是女神厅 或者直播
						if (res.data.data.chatRoomInfo.roomType == 27) {

						} else if (res.data.data.chatRoomInfo.roomType == 33) {

						} else {
							uni.showToast({
								title: '暂不支持厅',
								icon: "none",
								duration: 2000,
							});

							return
						}


						var url = '/pages/subpage/chatRoomDetails/chatRoomDetails?roomId=' + roomId +
							'&channelId=' + rid
							_this.yqjt = false
							getApp().globalData.yqjt = false

						uni.navigateTo({
							url: url,
						})

						return
					} else {
						uni.showToast({
							title: res.data.msg,
							icon: "none",
							duration: 2000,
						});
						return
					}
				});

				// isPrivate 判断是否是个私密厅

				// } else {
				// 	uni.showToast({
				// 		title: "此聊天室是私密厅，暂时无法进入~",
				// 		icon: "none",
				// 		duration: 2000,
				// 	});
				// 	return
				// }


			},



		}


	}
</script>

<style lang="scss" scoped>
	// 去掉圆角
	.Invite /deep/ .u-mode-center-box {
		background: none;
	}



	.beijingkuai {
		margin-left: 15upx;

		background: rgba(255, 255, 255, 0.20);
		border-radius: 10upx;
		border-radius: 10upx;
		padding: 3upx 10upx;
		font-family: PingFangSC-Regular;
		font-size: 16upx;
		color: #FFFFFF;

	}

	.sex {
		width: 66upx;
		height: 28upx;
		line-height: 28upx;
		color: #FFFFFF;
		font-size: 18upx;
		text-align: center;
	}

	.Invite /deep/ .vipNum {
		display: inline-block;
		width: 50upx;
		height: 24upx;
		background-size: contain;
		background-repeat: no-repeat;
		vertical-align: middle;
		margin-right: 2upx;
	}

	.zhong {
		display: flex;
		align-items: center;
		// border: 2upx solid #007AFF;
		height: 50upx;
	}



	.yqbj {
		width: 500upx;
		background-size: 100% 100%;
		// height: 500upx;/* 、 */
		background-image: url(https://webapp.test.shenghua6.cn/st/mini/static/img/xcxydy/tcbjs.png);
		text-align: center;
	}

	.toptitle {
		width: 300upx;
		background-size: 100% 100%;
		margin: 0 auto;
		padding: 8upx 20upx;
		background-image: url(https://webapp.test.shenghua6.cn/st/mini/static/img/xcxydy/tanchasndsk.png);
		font-family: PingFangSC-Medium;
		font-size: 24upx;
		color: #515494;

		text-align: center;
	}

	.yqauto {
		margin: 0 auto;
		width: 230upx;
		height: 230upx;

		background-size: 100% 100%;
		background-image: url(https://webapp.test.shenghua6.cn/st/mini/static/img/xcxydy/toxuias.png);
		display: flex;
		align-items: center;
		justify-content: center;

	}

	.yqtouxi {
		width: 150upx;
		height: auto;
		border-radius: 50%;

	}

	.yqname {
		width: 300upx;

		margin: auto;
		font-family: PingFangSC-Medium;
		font-size: 33upx;
		color: #FFFFFF;
		letter-spacing: 0.55px;
		text-align: center;

		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;

	}

	.yqxixi {
		display: flex;
		align-items: center;
		justify-content: center;
		// width: 300upx;
		margin: 0 auto;
		text-align: center;
	}





	.annius {
		position: absolute;
		z-index: 999;
		top: 90%;
		width: 450upx;
		line-height: 100upx;
		// margin: 0upx auto;
		text-align: center;
		color: #FFFFFF;
		background-image: linear-gradient(-44deg, #7078FF 0%, #B1A4FF 100%, #B1A4FF 100%);
		// box-shadow: 0 8px 9px 0 rgba(255, 255, 255, 0.72), 0 14px 9px 0 #DEF2FF, inset 0 0 9px 4px rgba(250, 230, 255, 0.16);
		border-radius: 52.5px;
		border-radius: 52.5px;


		left: 50%;

		margin-left: -225upx;

	}
</style>
